package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: PREETHI
 * Date: 22/5/13
 * Time: 11:14 PM
 * To change this template use File | Settings | File Templates.
 */
import javax.swing.*;
public class membership {
      JPanel panel;
     JLabel label;
     JTextField tf;
     library lib;
    public membership(library lib)
    {
           this.lib=lib;
            panel=new JPanel();
    }
    public JPanel viewMembership()
    {
        if(lib.getUsername() !=null)
        {
            userlist ul=new userlist();
            user u=ul.loginInfo.get(lib.getUsername());

            label=new JLabel("Name",JLabel.CENTER);
            label.setName("name");

            panel.add(label);
            tf=new JTextField(u.getUsername());
            tf.setEditable(false);
            panel.add(tf);
            label=new JLabel("E-Mail");
            label.setName("mail");
            panel.add(label);
            tf=new JTextField(u.getEmail());
            tf.setEditable(false);
            panel.add(tf);
            label=new JLabel("Phone no:");
            label.setName("phone");
            panel.add(label);
            tf=new JTextField(u.getPhoneno());
            tf.setEditable(false);
            panel.add(tf);

        }
        else
        {
            label=new JLabel("Please talk to the librarian! Thank You!",JLabel.CENTER);
            label.setName("talktolibrarian");
            panel.add(label);
        }
        return panel;
    }
}
